Repository navigation
feat: add dedicated VECTOR(n) type with dimension checking and casts - #416
alexskinner wants to merge 1 commit into
Conversation
Add LogicalType::Vector(u32) and DataValue::Vector to represent fixed-dimension
vector columns. Storage uses packed little-endian f32 bytes (4*dim per vector).
Core implementation:
- Parser support for VECTOR(n) via DataType::Custom in the generic type mapper
and VECTOR size names in the SQLite type mapper (SqlDialect::parse path)
- Dedicated DataValue::Vector { value: BinaryBytes, dim: u32 } variant
- Table codec serialization/deserialization (VectorSerializable)
- Cast from text '[a,b,c]' to vector and vector to text
- Display as '[a,b,c]' format (not hex bytes)
- Binary operators: equality and inequality (Eq, NotEq)
- Dimension validation on insert/update
- NULL handling
- Exhaustive pattern match coverage in wasm and python bindings
Tests:
- tests/slt/vector.slt: create, insert, select, cast, WHERE comparisons,
NULL, dimension mismatch errors, DESCRIBE, table reopen
Co-authored-by: Alex Skinner <alexskinner@users.noreply.github.com>
|
As it stands, this PR appears to only enable the storage of |
|
That makes complete sense, thanks for the clear explanation. Storing packed |
Add
LogicalType::Vector(u32)andDataValue::Vectorfor fixed-dimension vector columns, stored as packed little-endianf32bytes (4 * dim).VECTOR(n)in the generic sqlparser type mapper (DataType::Custom) and the SQLite type mapper, so it works throughSqlDialect::parse.Eq/NotEq, insert/update dimension checks, andtests/slt/vector.slt.